<?php
namespace Modules\Activity\Http\Controllers\Client;

use Illuminate\Http\Request;
use Illuminate\Routing\Controller;

use \Modules\Activity\Entities\TicketRecord;

use Validator;
use ThrowException;
use DB;
use Auth;
use Setting;

class TicketRecordController extends Controller
{
    public function index(Request $req)
    {
        $rule = [
            'uuid' => ['required']
        ];
        Validator::make($req->all(), $rule)->fails() && ThrowException::BadRequest(); 

        $user = Auth::requireLoginUser();

        $options = $req->all();

        // $options['page'] = 1;

        $options['where'] = [
            'node_uuid' => $req->input('uuid'),
            'user_id' => $user->id
        ];

        $list = TicketRecord::getList($options);

        return $list->generateListResponse();
    }

}
